package server;

import java.io.IOException;
import dataContracts.Command;
import client.ClientDirectory;

class DirectoryHandler implements Runnable {
	ClientConnection client;
	ServerProgram server;
	ClientDirectory clientDirectory;
	
	DirectoryHandler(ClientConnection client, ServerProgram server) {
		this.server = server;
		this.client = client;
	}
	
	@Override
	public void run() {
		client.command(Command.Type.SendDirectoryObject, "");
		try {
			clientDirectory = (ClientDirectory)client.objectReader.readObject();
			client.notify("Received directory in state: "+ clientDirectory.getChecksum());
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
}